gdk: fix reversed and sluggish scrolling on MacOS
authorAndy Russell <arussell123@gmail.com>
Mon, 14 Feb 2022 17:43:07 +0000 (12:43 -0500)
committerAndy Russell <arussell123@gmail.com>
Mon, 14 Feb 2022 19:05:39 +0000 (14:05 -0500)
commit37702af22b2991e8004c18531c809881bac8ed7f
treed8463cd08bc9f07380965965f11831bd8b31e15f
parent4cb599f378c2c71d2b42cd38f3ef040043d6f482
gdk: fix reversed and sluggish scrolling on MacOS

When using an external mouse on MacOS, the scrolling behavior is
reversed from the user's scrolling preference. Additionally, it is
noticeably sluggish.

This commit fixes both issues by negating the deltas and multiplying
them by 32 before constructing a new scroll event. 32 seems to be the
"traditional" scaling factor according to [Druid], but I'm not sure
where that value actually comes from. Regardless, scaling the deltas by
this amount makes scrolling feel a lot more responsive in the GTK demos.

Scrolling with a trackpad is not affected by either issue because it
triggers a different code path that uses more precise deltas, and
already negates them.

[Druid]: https://linebender.gitbook.io/linebender-graphics-wiki/mouse-wheel#external-mouse-wheel-vs-trackpad
gdk/macos/gdkmacosdisplay-translate.c